﻿<base:BaseForm x:Class="Finance.WPF.winFinance"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="clr-namespace:Infrastructure.UI.WPF;assembly=Infrastructure.UI.WPF"
    xmlns:Converters="clr-namespace:Infrastructure.UI.WPF.Converters;assembly=Infrastructure.UI.WPF"
    Title="Finance " Height="338" Width="402" 
    xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit">
    <Window.Resources>
        <Converters:CurrencyConverter x:Key="currencyConverter" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="2*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ListView Name="lstFinance" Grid.Row="0"  BorderThickness="0" Width="Auto"
                  AlternationCount="2" 
                  IsSynchronizedWithCurrentItem="True" >
            <ListView.View>
                <GridView AllowsColumnReorder="true" ColumnHeaderToolTip="Current Item">
                    <GridViewColumn Header="Date" 
            		DisplayMemberBinding="{Binding Path=Date}" 
            		Width="75"/>
                    <GridViewColumn Header="Type"  
                  DisplayMemberBinding="{Binding Path=Type}"
                  Width="75" />
                    <GridViewColumn Header="Account" 
                  DisplayMemberBinding="{Binding Converter={StaticResource currencyConverter},Path= Amount}"
                  Width="75" >
                    </GridViewColumn>
                    <GridViewColumn Header="Desc"  
                  DisplayMemberBinding="{Binding Path=Desc}"
                  Width="75" />
                </GridView>
            </ListView.View>
        </ListView>
        <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" 
                  ResizeBehavior="PreviousAndNext" 
                  Height="5" Background="Azure" />
        <Expander Name="expDetail" Grid.Row="2" ExpandDirection="Down" IsExpanded="True" 
                  DataContext="{Binding ElementName=lstFinance, Path=SelectedItem}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="25" />
                    <RowDefinition Height="25" />
                    <RowDefinition Height="25" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Label Grid.Column="0" Grid.Row="0">Date</Label>
                <my:DatePicker Name="dteDate" SelectedDate="{Binding Path=Date}" Grid.Column="1" Grid.Row="0" Margin="1"></my:DatePicker>

                <Label Grid.Column="2" Grid.Row="0">Account</Label>
                <TextBox Name="txtAmount" Text="{Binding Converter={StaticResource currencyConverter},Path= Amount}" 
                         Grid.Column="3" Grid.Row="0" Margin="2"></TextBox>
                <Label Grid.Column="0" Grid.Row="1">Type</Label>
                <ComboBox Name="cboType" Text="{Binding Type}" Grid.Column="1" Grid.Row="1" Margin="2">
                    <ComboBoxItem>IN</ComboBoxItem>
                    <ComboBoxItem>OUT</ComboBoxItem>
                    <ComboBoxItem>IN_ADJUST</ComboBoxItem>
                    <ComboBoxItem>OUT_ADJUST</ComboBoxItem>
                </ComboBox>
                <Label Grid.Column="2" Grid.Row="1">Desc</Label>
                <TextBox Name="txtDesc" Text="{Binding Desc}" Grid.Column="3" Grid.Row="1" Margin="2"></TextBox>
                <Button Name="btnAdd" Click="btnAdd_Click"  Grid.Column="1" Grid.Row="2" Margin="2">Add</Button>
                <Button Name="btnUpdate" Click="btnUpdate_Click" Grid.Column="2" Grid.Row="2" Margin="2">Update</Button>
                <Button Name="btnInsert" Click="btnInsert_Click"  Grid.Column="2" Grid.Row="2" Margin="2" Visibility="Hidden">Insert</Button>
            </Grid>
        </Expander>
    </Grid>
</base:BaseForm>
